using System.Collections.Generic;
using Microsoft.Xna.Framework.Input;

namespace Game500.ClientServerCommon.Src.Networking
{
  public class NetworkKeyboardState
  {
    private readonly List<byte> myPressedKeys = new List<byte>();

    public NetworkKeyboardState(KeyboardState state)
    {
      if (state.IsKeyDown(Keys.Left)) myPressedKeys[0] = (int)Keys.Left;
      if (state.IsKeyDown(Keys.Right)) myPressedKeys[1] = (int)Keys.Right;
      if (state.IsKeyDown(Keys.Up)) myPressedKeys[2] = (int)Keys.Right;
    }

    public NetworkKeyboardState(byte[] keys)
    {
    }

    public byte[] GetBytes()
    {
      return myPressedKeys.ToArray();
    }

    public bool IsKeyPressed(Keys key)
    {
      return myPressedKeys.Contains((byte)key);
    }
  }
}